package reflect;

import java.lang.reflect.Method;

public class ReflectDemo8 {
    public static void main(String[] args) throws Exception{
        Class cls = Class.forName("reflect.Foo");
        Object o = cls.newInstance();

        Method m = cls.getDeclaredMethod("A");
        if (m.isAnnotationPresent(AutoRun.class)){
            AutoRun autoRun = m.getAnnotation(AutoRun.class);
            int num = autoRun.value();
            System.out.println(num);
        }
        Method m1 = cls.getDeclaredMethod("C");
        if (m1.isAnnotationPresent(AutoRun.class)){
            AutoRun autoRun = m1.getAnnotation(AutoRun.class);
            int num = autoRun.value();
            System.out.println(num);
        }


    }
}
